import logging
import json

import requests
from django.contrib.auth import logout, login, authenticate
from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect
from requests.auth import HTTPBasicAuth
from rest_framework import generics, permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from django.contrib.auth.models import Group
from django.contrib.auth import authenticate, login, logout

from .models import User
from .serializers import UserSerializer, GroupSerializer
from .forms import LoginForm


logger = logging.getLogger('apps.Deliver.views')


# Create the API views
